package chan.project.smartlaweveryman.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import chan.project.smartlawmodel.entity.UserRole;
import chan.project.smartlaweveryman.service.UserRoleService;
import chan.project.smartlaweveryman.mapper.UserRoleMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 彭科文
* @description 针对表【user_role】的数据库操作Service实现
* @createDate 2025-07-03 17:52:54
*/
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole>
    implements UserRoleService{

    /**
     * 校验当前用户登录角色是否存在
     * @param userId
     * @return
     */
    @Override
    public List<UserRole> getUserRoleByUserId(String userId, String RoleId) {
        LambdaQueryWrapper<UserRole> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserRole::getUserId, userId);
        return this.list(queryWrapper);
    }
}




